from django.db import models

# Create your models here.
class Author(models.Model):
    name =  models.CharField(max_length=32)
    age = models.IntegerField()
    email = models.EmailField(null=True,blank=True,unique=True)
    def __str__(self):
        return self.name
class Publisher(models.Model):
    name = models.CharField(max_length=32,null=True,blank=True,unique=True)
    city = models.CharField(max_length=32)
    def __str__(self):
        return self.name
class Books(models.Model):
    name = models.CharField(max_length=32)
    author = models.ManyToManyField(Author)
    publisher = models.ForeignKey(Publisher)
    price = models.IntegerField()
    def __str__(self):
        return "%s--%s" %(self.name,self.price)

